﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CMWVS.Core.Mono;
using System.Diagnostics;
using System.IO;

namespace CMWVS.Core.Commands
{
    public class CompileCommand: RelayCommand<CompileCommandParamater, CompileCommandResult>
    {

        #region Constructor

        private CompileCommand()
        {

        }

        internal CompileCommand(MonoConfig monoconfig)
        {
            m_Compiler = new MonoCompiler(monoconfig);
            this.SetCommands();
        }

        #endregion

        private MonoCompiler m_Compiler;

        private void SetCommands()
        {
            base.m_CanExecute = () =>
                {
                    return m_Compiler.CanExecute();
                };
            base.m_Commmand = (compileParameter) =>
                {
                    m_Compiler.Execute(new MonoCompilerParams(compileParameter.SLN, compileParameter.Listener, new Build()));
                    return new CompileCommandResult();
                };
        }
    }
}
